<!doctype html>
<html>
<!-- InstanceBegin template="/Templates/template1.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>活动发布</title>
<!-- InstanceEndEditable -->

<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/checkLogin.js"></script> 
<link href="../css/Pager.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery.pager.js"></script>
<script type="text/javascript" src="../js/gbRst.js"></script>
<script type="text/javascript" src="../js/doubleDate2.0.js"></script>
	<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="../js/ajaxfileupload.js"></script> 
<script type="text/javascript" src="../js/ImageBrowsing.js"></script> 
	<script charset="utf-8" src="../js/kindeditor.js"></script>
		<script charset="utf-8" src="../js/lang/zh_CN.js"></script>
<script type="text/javascript" src="../js/formValidator.js"></script>
	<script type="text/javascript" src="../js/formValidatorRegex.js"></script>
<link href="../css/validator3.css" type="text/css" rel="stylesheet" />
	<link href="../css/style.css" type="text/css" rel="stylesheet" />

<script type="text/javascript">
$(function(){
	refreshInput($(".serWrapper"));
	$(".hideDiv").each(function(){
		addMargin($(this));
	})
	$("#shopIsChoosed").click(function(){
		if($("#shopIsChoosed").is(":checked")){
			$("#shopName").attr("disabled",false);
			$("#research").attr("disabled",false);
			
		}else{
			$("#shopName").attr("disabled",true);

		}
	});
	$('.doubledate').kuiDate({
		className:'doubledate',
		isDisabled: "1"  // isDisabled为可选参数，“0”表示今日之前不可选，“1”标志今日之前可选
	});
	
	var flag=getIdByName('flag');
	if(flag==1){
		findActivitesList()
	}else if(flag==2){
		var shopCheck=getIdByName("shopCheck")
		if(shopCheck==1){
			$("#shopIsChoosed").attr("checked","checked");	
			$("#shopName").attr("disabled",false);
			html= "<option value='"+getIdByName("shopId")+"'>"+decodeURI(getIdByName("shopName"))+"</option>"
			$("#shopName").html(html)
		}
		var name= getIdByName('actName');
		var code=getIdByName('subMan');
		name= decodeURI(name);
		code=decodeURI(code)
		$("#searchActName").val(name);
		$("#searchMan").val(code);
		var p=getIdByName('pageIndex');
		$("#searchstatus").val(getIdByName("searchstatus"))
		pageIndex=p;
		findActivitesList()
	}
	

});
</script>
<script type="text/javascript">
var pageIndex=1;
var pageCount=0;
var pagecount=0;
var shopPageIndex=0;
var shopCount=0;
var actLargeTypeId=0;
var actLargePageIndex=1;
var actLargePageCount=0;
var actSmallPageIndex=1;
var actSmallPageCount=0;
var rptPageIndex=1;
var rptPageCount=0;
var htmlStr=null;
var activityId=null;
var actSmallTypeId =0;
$(function(){
	
	//findActivitesList();
	$.ajax({
		url:'../actLargeType/find/all/'+actLargePageIndex+'/10',
		datatype:'json',
		type:'get',
		success:
			function(data){
			var rst= JSON.parse(data);
			if(IsEmpty(rst)){
			art.dialog({fixed:false, lock: true,content:"查询出错",icon:'error',ok:true});
			return false;
			}
			if(rst.state==0){
				loadActLargeListTable(rst)
			}else if(rst.state==1){
				art.dialog({fixed:false, lock: true,content:rst.msg,icon:'error',ok:true});	
			}else{
				checkStateShowErrorMsgAndDealResult(data);
			}
			
			
		}
	})
	
	$("input[type='file']").change(function(){
		$(this).prev().prev().val($(this).val())
	})
	
	$("#closeThe").click(function(){
		$("#windowPop,#yinying1").hide();
	})

	
	
	
	
	
	
	$("#closeThis").click(function(){
				$("#PopList").hide();
				$("#yinying1").css("z-index",100);
			})
	
})

PageClick = function(pageclickednumber) {
	pageIndex=pageclickednumber;
	findActivitesList();
}


function uploads(id,content,flag){

	$.ajaxFileUpload({
		url :"../activity/upload/image/indexImage/"+id,
		secureuri : false,
		fileElementId : 'upload',
		dataType : 'json',
		success : function(data){
			if(IsEmpty(data)){
				art.dialog({fixed:false, lock: true,content:"上传图片出错",icon:'error',ok:true});
				return false;
				}
				if(data.state==0){
					if(flag==0){
					art.dialog({fixed:false, lock: true,content:"操作成功",icon:'succeed',ok:true});
					pageIndex=1;
					findActivitesList();
					resetForm();
					$("#yinying1,#content").hide();
					}else{	
						$("#doflag").val(2);
						$("#updateId").val(id)
						art.dialog({fixed:false, lock: true,content:"首页修改失败,请重新编辑",icon:'error',ok:true});
					}	
				}else if(data.state==1){
					$("#doflag").val(2);
					$("#updateId").val(id)
					if(flag==0){
					art.dialog({fixed:false, lock: true,content:"保存图片出错,请重新上传图片",icon:'error',ok:true});	
					}else{
						art.dialog({fixed:false, lock: true,content:"图片和首页保存出错,请重新编辑",icon:'error',ok:true});	
					}
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
				
		},
		error : function(data) {
			art.dialog({fixed:true, lock: true,content:'上传图片失败',icon:'error',ok:true});	
			return false;
		}
	});
}

function toAdds(){
	alert("todadd")
	window.location.href="addActivitie.html?menu="+getIdByName("menu")+"&submenu="+getIdByName("submenu")
	/* 	$("#yinyingCenter,#windowPop").show();
		addMargin($("#windowPop"))
 */
}


function loadActLargeListTable(json){
	$("#actLargeList tbody").empty();
	var len=json.result.len;
		for(i=0;i<json.result.data.length;i++){
			if(len>=4){
			if(i%4==0){
				$("#actLargeList ").append("<tr></tr>");
							}	
					}else{
						$("#actLargeList ").append("<tr></tr>");		
					}
		var id=getHeadIndexValue(i, json, "id");
		var pName=getHtmlString(getHeadIndexValue(i, json, "name"));
		var htm="<td>"+pName+"</td><td><input class='common_btn' type='button' value='选择' onclick = \"chooseActLargeType("+id+",'"+pName+"')\"></td>	";

		$("#actLargeList tr:last").append(htm)
		}
}

function chooseActLargeType(id,name){
	actLargeTypeId=id;
	$("#actLargeType").val(name);
	$("#window1,#yinying").hide();
	getActSmallType(id);
	
}

function getActSmallType(id){
	
	$.ajax({
		url:'../actSmallType/find/ltId/'+id+'/'+actSmallPageIndex+'/20',
		datatype:'json',
		type:'get',
		success:
			function(data){
			var rst= JSON.parse(data);
			if(IsEmpty(rst)){
				art.dialog({fixed:false, lock: true,content:"查询出错",icon:'error',ok:true});
				return false;
				}
				if(rst.state==0){
					loadActSmallListTable(rst)
				}else if(rst.state==1){
					art.dialog({fixed:false, lock: true,content:rst.msg,icon:'error',ok:true});	
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
			
		}
	})
}

function loadActSmallListTable(json){
	$("#actSmallList tbody").empty();
	var len=json.result.len;
		for(i=0;i<json.result.data.length;i++){
			if(len>=4){
			if(i%4==0){
				$("#actSmallList ").append("<tr></tr>");
							}	
					}else{
						$("#actSmallList ").append("<tr></tr>");		
					}
		var id=getHeadIndexValue(i, json, "id");
		var pName=getHtmlString(getHeadIndexValue(i, json, "name"));
		var htm="<td>"+pName+"</td><td><input class='common_btn' type='button' value='选择' onclick = \"chooseActSmallType("+id+",'"+pName+"')\"></td>	";

		$("#actSmallList tr:last").append(htm)
		}
}

function chooseActSmallType(id,name){
	actSmallTypeId=id;
	$("#actSmallType").val(name);
	$("#window2,#yinying").hide();
}

function findXY(){
	var address=$("#addr").val()
	$("#lat").val("")
	$("#lng").val("")
	$.get("../sys/find/xy",{"address":address}, function(data) {
		var dt = JSON.parse(data);
			if(IsEmpty(dt)){
			art.dialog({fixed:false, lock: true,content:"查询出错",icon:'error',ok:true});
			return false;
			}
			if(dt.state==0){
				$("#lat").val( getHeadIndexValue(0, dt, "lat"))
				$("#lng").val(getHeadIndexValue(0, dt, "lng"))
			}else if(dt.state==1){
				art.dialog({fixed:false, lock: true,content:dt.msg,icon:'error',ok:true});	
			}else{
				checkStateShowErrorMsgAndDealResult(dt);
			}
		
	});
}

function toSave(){
	var doflag=$("#doflag").val();
	if(doflag==1){
		save();
	}else if(doflag==2){	
		updateInfo()
	}
}


function save(){
	var shopName=$("#shopName2").val().replace(/\s/gi,'');
	if(IsEmpty(shopName)){
		art.dialog({fixed:true, lock: true,content:'请选择店铺',icon:'error',ok:true});	
		return false;
	}
	var actName=$("#actName").val().replace(/\s/gi,'');
	if(IsEmpty(actName)){
		art.dialog({fixed:true, lock: true,content:'活动名称不能为空',icon:'error',ok:true});
		$("#actName").focus();
		return false;
	}else{
		if(actName.length>50){
			art.dialog({fixed:true, lock: true,content:'活动名称过长(50字以内)',icon:'error',ok:true});
			$("#actName").focus();
			return false
		}
	}
	var actBeginTime=$("#actBeginTime").val().replace(/\s/gi,'');
	if(IsEmpty(actBeginTime)){
		art.dialog({fixed:true, lock: true,content:'请选择活动开始时间',icon:'error',ok:true});
		return false;
	}
	var actEndTime=$("#actEndTime").val().replace(/\s/gi,'');
	if(IsEmpty(actEndTime)){
		art.dialog({fixed:true, lock: true,content:'请选择活动结束时间',icon:'error',ok:true});
		return false;
	}
	var rptBeginTime=$("#rptBeginTime").val().replace(/\s/gi,'');
	if(IsEmpty(rptBeginTime)){
		art.dialog({fixed:true, lock: true,content:'请选择报名开始时间',icon:'error',ok:true});
		return false;
	}
	var rptEndTime=$("#rptEndTime").val().replace(/\s/gi,'');
	if(IsEmpty(rptEndTime)){
		art.dialog({fixed:true, lock: true,content:'请选择报名结束时间',icon:'error',ok:true});
		return false;
	}
	var addr=$("#addr").val().replace(/\s/gi,'');
	var lat=$("#lat").val().replace(/\s/gi,'');
	var lng=$("#lng").val().replace(/\s/gi,'');
	if(IsEmpty(lat)||IsEmpty(lng)){
		art.dialog({fixed:true, lock: true,content:'请获取活动所在地经纬度',icon:'error',ok:true});
		return false;
	}	
	var submitMan=$("#submitMan").val().replace(/\s/gi,'');
	var price=$("#price").val().replace(/\s/gi,'');
	if(IsEmpty(price)){
		price=0;
	}else{
		var exp = /^([1-9][\d]{0,7}|0)(\.[\d]{1,2})?$/;
	    if(!exp.test(price)){
	    	$("#price").focus();	
		art.dialog({fixed:true, lock: true,content:'原价格式错误,请输入有效金额',icon:'error',ok:true});
		return false;
	    }
	}
	var actContent=$("#actContent").val().replace(/\s/gi,'')
	if(actContent.length>50){
		$("#actContent").focus()
		art.dialog({fixed:true, lock: true,content:'简介过长(50字以内)',icon:'error',ok:true});
		return false
	}
	var oldPriceDes=$("#oldPriceDes").val().replace(/\s/gi,'')
	if(oldPriceDes.length>20){
		$("#oldPriceDes").focus();
		art.dialog({fixed:true, lock: true,content:'原价描述过长(20字以内)',icon:'error',ok:true});
		return false
	}
	var priceDes=$("#priceDes").val().replace(/\s/gi,'')
	if(priceDes.length>20){
		$("#priceDes").focus();
		art.dialog({fixed:true, lock: true,content:'现价描述过长(20字以内)',icon:'error',ok:true});
		return false
	}
	var offDes=$("#offDes").val().replace(/\s/gi,'')
	if(offDes.length>50){
		$("#offDes").focus();
		art.dialog({fixed:true, lock: true,content:'优惠描述过长(50字以内)',icon:'error',ok:true});
		return false
	}
	var shopId=$("#shopId").val();
	var actType=$("#actType").val();
	var fileName=$("#upload").val();
	if(IsEmpty(fileName)){
		art.dialog({fixed:true, lock: true,content:'请选择图片',icon:'error',ok:true});	

		return false;
	}
	var heads=new Array("address","smallId","name","content","shopId","shopName","Lng","lat","submitMan","actBeginDate","actEndDate","rptBeginDate","rptEndDate","oldPriceDes","priceDes","offDes","type","price")
	var datas=new Array(addr,actSmallTypeId,actName,actContent,shopId,shopName,lng,lat,submitMan,actBeginTime,actEndTime,rptBeginTime,rptEndTime,oldPriceDes,priceDes,offDes,actType,price)
	
	var parser = new Object();
	var jsonParserStr = null;
	if (IsNotEmpty(datas)){
		addToParser(heads, datas, "add" , parser);
		jsonParserStr =  JSON.stringify(parser);
	}
	
	
	$.post("../activity/insert",{"data":jsonParserStr}, function(data) {
		var dt = JSON.parse(data);
			if(IsEmpty(dt)){
			art.dialog({fixed:false, lock: true,content:"添加出错",icon:'error',ok:true});
			return false;
			}
			if(dt.state==0){
			 var flag= addIndexHtml(getHtmlInt(getHeadIndexValue(0, dt, "id")));
			
			 uploads(getHtmlInt(getHeadIndexValue(0, dt, "id")),"添加",flag);
			}else if(dt.state==1){
				art.dialog({fixed:false, lock: true,content:"添加出错",icon:'error',ok:true});
			}else{
				checkStateShowErrorMsgAndDealResult(data);
			}
	});
	
}
function updateInfo(){
	var id=$("#updateId").val();
	var shopName=$("#shopName2").val().replace(/\s/gi,'');
	if(IsEmpty(shopName)){
		art.dialog({fixed:true, lock: true,content:'请选择店铺',icon:'error',ok:true});	
		return false;
	}
	var actName=$("#actName").val().replace(/\s/gi,'');
	if(IsEmpty(actName)){
		art.dialog({fixed:true, lock: true,content:'活动名称不能为空',icon:'error',ok:true});
		$("#actName").focus();
		return false;
	}else{
		if(actName.length>50){
			art.dialog({fixed:true, lock: true,content:'活动名称过长(50字以内)',icon:'error',ok:true});
			$("#actName").focus();
			return false
		}
	}
	var actBeginTime=$("#actBeginTime").val().replace(/\s/gi,'');
	if(IsEmpty(actBeginTime)){
		art.dialog({fixed:true, lock: true,content:'请选择活动开始时间',icon:'error',ok:true});
		return false;
	}
	var actEndTime=$("#actEndTime").val().replace(/\s/gi,'');
	if(IsEmpty(actEndTime)){
		art.dialog({fixed:true, lock: true,content:'请选择活动结束时间',icon:'error',ok:true});
		return false;
	}
	var rptBeginTime=$("#rptBeginTime").val().replace(/\s/gi,'');
	if(IsEmpty(rptBeginTime)){
		art.dialog({fixed:true, lock: true,content:'请选择报名开始时间',icon:'error',ok:true});
		return false;
	}
	var rptEndTime=$("#rptEndTime").val().replace(/\s/gi,'');
	if(IsEmpty(rptEndTime)){
		art.dialog({fixed:true, lock: true,content:'请选择报名结束时间',icon:'error',ok:true});
		return false;
	}
	var addr=$("#addr").val().replace(/\s/gi,'');
	var lat=$("#lat").val().replace(/\s/gi,'');
	var lng=$("#lng").val().replace(/\s/gi,'');
	if(IsEmpty(lat)||IsEmpty(lng)){
		art.dialog({fixed:true, lock: true,content:'请获取活动所在地经纬度',icon:'error',ok:true});
		return false;
	}	
	var submitMan=$("#submitMan").val().replace(/\s/gi,'');
	var price=$("#price").val().replace(/\s/gi,'');
	if(IsEmpty(price)){
		price=0;
	}else{
		var exp = /^([1-9][\d]{0,7}|0)(\.[\d]{1,2})?$/;
	    if(!exp.test(price)){
	    	$("#price").focus();	
		art.dialog({fixed:true, lock: true,content:'原价格式错误,请输入有效金额',icon:'error',ok:true});
		return false;
	    }
	}
	var actContent=$("#actContent").val().replace(/\s/gi,'')
	if(actContent.length>50){
		$("#actContent").focus()
		art.dialog({fixed:true, lock: true,content:'简介过长(50字以内)',icon:'error',ok:true});
		return false
	}
	var oldPriceDes=$("#oldPriceDes").val().replace(/\s/gi,'')
	if(oldPriceDes.length>20){
		$("#oldPriceDes").focus();
		art.dialog({fixed:true, lock: true,content:'原价描述过长(20字以内)',icon:'error',ok:true});
		return false
	}
	var priceDes=$("#priceDes").val().replace(/\s/gi,'')
	if(priceDes.length>20){
		$("#priceDes").focus();
		art.dialog({fixed:true, lock: true,content:'现价描述过长(20字以内)',icon:'error',ok:true});
		return false
	}
	var offDes=$("#offDes").val().replace(/\s/gi,'')
	if(offDes.length>50){
		$("#offDes").focus();
		art.dialog({fixed:true, lock: true,content:'优惠描述过长(50字以内)',icon:'error',ok:true});
		return false
	}
	var shopId=$("#shopId").val();
	var actType=$("#actType").val();

	var heads=new Array("address","smallId","name","content","shopId","shopName","Lng","lat","submitMan","actBeginDate","actEndDate","rptBeginDate","rptEndDate","oldPriceDes","priceDes","offDes","type","price","id")
	var datas=new Array(addr,actSmallTypeId,actName,actContent,shopId,shopName,lng,lat,submitMan,actBeginTime,actEndTime,rptBeginTime,rptEndTime,oldPriceDes,priceDes,offDes,actType,price,id)
	
	var parser = new Object();
	var jsonParserStr = null;
	if (IsNotEmpty(datas)){
		addToParser(heads, datas, "edit" , parser);
		jsonParserStr =  JSON.stringify(parser);
	}
	$.post("../activity/edit",{"data":jsonParserStr}, function(data) {
		var dt = JSON.parse(data);
		if(IsEmpty(dt)){
			art.dialog({fixed:false, lock: true,content:"修改出错",icon:'error',ok:true});
			return false;
			}
			if(dt.state==0){
				var fileName=$("#upload").val();
				var flag=	addIndexHtml(id);
				if(IsNotEmpty(fileName)){
					uploads(id,"修改",flag);
				}else{
					if(flag>0){	
					art.dialog({fixed:false, lock: true,content:"首页修改出错,请重新编辑",icon:'error',ok:true});
					}else{
						art.dialog({fixed:false, lock: true,content:"修改成功",icon:'succeed',ok:true});
						findActivitesList();
						$("#yinying1,#content").hide();	
					}
				}
						
			}else if(dt.state==1){
				art.dialog({fixed:false, lock: true,content:dt.msg,icon:'error',ok:true});
			}else{
				checkStateShowErrorMsgAndDealResult(data);
			}
		
	});
	
}
function addIndexHtml(id){
		var flag = 0;
	var indexHtml=htmlStr;
	if(IsNotEmpty(indexHtml)){
		$.ajax({
			type : "post",
			async:false,
			data :{"htmlStr":indexHtml},
			datatype : "json",
			url : "../htmlUtils/upload/activityHtmlInit/"+id+"/activityIndex",
			success : function(data) {
				var rst = JSON.parse(data);				
				if(IsEmpty(rst)){
					flag=1;
					}
					if(rst.state==0){
						flag=0;
					}else if(rst.state==1){
						flag=1;
					}
			}	
		});
		
	}
	return flag;
}

function findActivitesList(){
	var name=$("#searchActName").val().replace(/\s/gi,'');	
	var subMan=$("#searchMan").val().replace(/\s/gi,'');
	var shopId="";
	var param=null;
	if($("#shopIsChoosed").is(":checked")){	
		shopId=$("#shopName").val();
		if(shopId!=""&&shopId!=null){
		param={'name':name,'SubmitMan':subMan,'shopId':shopId}	
		}else{
		param={'name':name,'SubmitMan':subMan}	
		}
	}else{
		param={'name':name,'SubmitMan':subMan}	
	}
	var page=pageIndex-1;
	
	$.ajax({
		url:'../activity/find/activityList/'+page+'/10',
		datatype:'json',
		type:'get',
		data:param,
		success:
			function(data){
			var rst= JSON.parse(data);
			if(IsEmpty(rst)){
				art.dialog({fixed:true, lock: true,content:"查詢出錯",icon:'error',ok:true});	
				return false;
				}
				if(rst.state==0){
					if(rst.result.len==0){
						$("#NoResult").show();
					}else{
						$("#NoResult").hide();
					}
					$("#sup").html("共："+rst.result.len+"条")
					loadtable(rst)
					 var shu = rst.result.len;
						pagecount = Math.ceil(shu/10);	
					 $("#pager").pager({ pagenumber:pageIndex, pagecount: pagecount, buttonClickCallback: PageClick });
				}else if(rst.state==1){
					art.dialog({fixed:true, lock: true,content:rst.msg,icon:'error',ok:true});	
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}	
			
		}
	})
}

function loadtable(rst){
	$("#activiteList tbody").empty();
	for(i=0;i<rst.result.data.length;i++){	
	var actId=getHeadIndexValue(i, rst, "id");
	$("#activiteList tbody").append("<tr id='act_"+actId+"'></tr>");
	
	var htmlString="<td id='actList_shopName_"+actId+"'>"+getHeadIndexValue(i, rst, "shopName")+"</td>"
	htmlString+="<td id='actList_actName_"+actId+"'>"+getHeadIndexValue(i, rst, "name")+"</td>"
	htmlString+="<td><img id='actList_image_"+actId+"' src='"+getHeadIndexValue(i, rst, "imageURL")+"?time="+(new Date()).getTime()+"'></td>"
	htmlString+="<td id='actList_beginTime_"+actId+"'>"+getHeadIndexValue(i, rst, "actBeginDate")+"</td>"
	htmlString+="<td id='actList_endTime_"+actId+"'>"+getHeadIndexValue(i, rst, "actEndDate")+"</td>"
	htmlString+="<td id='actList_swpType_"+actId+"'>"+getHeadIndexValue(i, rst, "typeName")+"</td>"
	htmlString+="<td id='actList_subman_"+actId+"'>"+getHeadIndexValue(i, rst, "submitMan")+"</td>"
	htmlString+="<td id='actList_subDate_"+actId+"'>"+getHeadIndexValue(i, rst, "submitDate")+"</td>"
	htmlString+="<td id='actList_staName_"+actId+"'>"+getHeadIndexValue(i, rst, "staName")+"</td>"	
	htmlString+="<td id='actList_actContent_"+actId+"' style='display:none;'>"+getHeadIndexValue(i, rst, "content")+"</td>"
	htmlString+="<td id='actList_do_"+actId+"'><input class=\"common_btn check_btn\" type=\"button\" onclick=\"showDet("+actId+")\" value=\"查看详情\"><br><input type='hidden' id='actList_shopId_"+actId+"' value='"+getHeadIndexValue(i, rst, "shopId")+"'> <input onclick='toUpdate("+actId+")' class=\"common_btn\" type=\"button\" value=\"修改\"><br><input onclick='popPoint("+actId+")' class=\"del common_btn\" type=\"button\" value=\"删除\"></td>"
	$("#activiteList tbody tr:last").append(htmlString)
	}
	
	
}

function deleteInfo(id){	
	
	if(IsNotEmpty(id)){

		$.post("../activity/del",{"id":id}, function(data) {
			var dt = JSON.parse(data);		
			if(IsEmpty(dt)){
				art.dialog({fixed:true, lock: true,content:"刪除出錯",icon:'error',ok:true});	
				return false;
				}
				if(dt.state==0){
					art.dialog({fixed:true, lock: true,content:"刪除成功",icon:'succeed',ok:true});	
					findActivitesList()
				}else if(dt.state==1){
					art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});	
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
			
		});
	}
}



function InitShopList(shopPageIndex){
	var shopName=$("#searchName").val();
	$.ajax({
		type : "post",
		async:false,
		data :'name='+shopName,
		datatype : "json",
		url : "../shop/find/shopList/" + shopPageIndex + "/5",
		success : function(data) {
			var rst = JSON.parse(data);
						
					$("#shopList tbody tr").remove();
						if(IsEmpty(rst)){
							art.dialog({fixed:true, lock: true,content:"查询出錯",icon:'error',ok:true});	
							return false;
							}
							if(rst.state==0){
								initShopTable(rst);
								$("table[id='shopList'] tbody tr").each(function(){
									$(this).children("td:last").css("text-align","center").append("<input type='button' class='common_btn' value='选择' onclick='bclicks($(this))'>");

								})
								if(rst.result.len > 0){								
									 var shu = rst.result.len;
									 shopCount = Math.ceil(shu/5);					
									 }else{
											shopCount==0;

									 }	
								 $("#shopPager").pager({ pagenumber: ++shopPageIndex, pagecount: shopCount, buttonClickCallback: ShopPageClick });
								 addMargin($("#shopShow"));
							
							}else if(rst.state==1){
								art.dialog({fixed:true, lock: true,content:"查询出錯",icon:'error',ok:true});	
							}else{
								checkStateShowErrorMsgAndDealResult(data);
							}		 
					 
					 
					
		}	
	});	
	
}
ShopPageClick = function(pageclickednumber) {
    $("#shopPager").pager({ pagenumber: --pageclickednumber, pagecount: pagecount, buttonClickCallback: PageClick });
    $("#result").html("Clicked Page " + pageclickednumber);
    InitShopList(pageclickednumber);
}
function shopExits(id){
	var bloo=false
	$("#shopName").find("option").each(function(){
		
		if($(this).attr("value")===id){
			bloo= true;
			return bloo;
		}
	})
	return bloo;
}
function getParamToshopS(id,name){
	
	var shopflag=$("#shopflag").val();
	if(shopflag==1){
		var htm="<option value='"+id+"'>"+name+"</option>";
		$("#shopName").html(htm);
		$("#shopName").val(id);	
	}else{	
	$("#shopId").val(id);
	$("#shopName2").val(name);
	}
	closeShopShow();
}

function closeShopShow(){
	$("#shopShow,#yinying").hide();
	$("#searchName").val("")
}
function initShopTable(json){
	if(json!=null && json.state==0){
		var params = new Array("id", "name","mp","contact");
		Loadtable(json,params,"shopList");
	}
}


function Loadtable(json, params, tableId){
	var phArray = new Array();
	var count = 0;
	if (params != null) {
		$(params).each(function(pIndex, pData) {
			$.each(json.result.head, function(hIndex, hData) {
				if (pData == hData) {
					phArray[count++] = hIndex;
				}
			});
		});
	}
	if (json.result.data != null) {
		$.each(json.result.data, function(index, dt) {
			$("table[id='" + tableId + "']").append("<tr></tr>");
			$(phArray).each(function(phIndex, data) {
				$.each($(dt), function(dtIndex, d) {
					if (dtIndex == data) {
						$("table[id='" + tableId + "'] tr:last").append("<td>" +  (d === null||d == "null" ? " " : d) + "</td>");
					}
				});
			});
		});
		
	}
	

	
}

function showShopList(flag){
	$("#shopflag").val(flag)
	$("#shopIsChoosed").attr("checked","checked");
	$("#shopName").blur();
	$("#shopShow,#yinying").show();
	InitShopList(0);
}
function bclicks(obj){
	var $first=obj.parent("td").parent("tr").children("td:first");
	var id=$first.html();
	var name=$first.next().html();
	//$("#shopName").children("option").blur();
	getParamToshopS(id,name)
}

function toUpdate(actId){
	if($("#shopIsChoosed").is(":checked")){
		var shopID=$("#shopName").val();
		var shopName=$("#shopName").text()
		if(IsEmpty(shopID)){
			shopId="";
		}
	window.location.href="makeActivitie.html?shopCheck=1&actId="+actId+"&shopId="+shopID+"&actName="+$("#searchActName").val()+"&subMan="+$("#searchMan").val()+"&pageIndex="+pageIndex+"&shopName="+shopName+"&menu="+getIdByName("menu")+"&submenu="+getIdByName("submenu");
	}else{
		window.location.href="makeActivitie.html?shopCheck=0&actId="+actId+"&shopId="+$("#shopName").val()+"&actName="+$("#searchActName").val()+"&subMan="+$("#searchMan").val()+"&pageIndex="+pageIndex+"&menu="+getIdByName("menu")+"&submenu="+getIdByName("submenu");
	}
		/* resetForm()
	$.ajax({
		url:'../activity/find/activity/actId/'+actId,
		async:false,
		datatype:'json',
		type:'get',
		success:
			function(data){
			var rst= JSON.parse(data);			
			if(IsEmpty(rst)){
				art.dialog({fixed:true, lock: true,content:"查询出錯",icon:'error',ok:true});	
				return false;
				}
				if(rst.state==0){
						$("#shopName2").val(getHtmlString(getHeadIndexValue(0, rst, "shopName")));
						$("#shopId").val(getHtmlString(getHeadIndexValue(0, rst, "shopId")));
						$("#actName").val(getHtmlString(getHeadIndexValue(0, rst, "name")));
						$("#imageUrl").val(getHtmlString(getHeadIndexValue(0, rst, "imageURL")));
						$("#imgSrc img").attr("src",getHtmlString(getHeadIndexValue(0, rst, "imageURL")))
						$("#actLargeType").val(getHtmlString(getHeadIndexValue(0, rst, "ActLargeName")));
						getActSmallType(getHtmlString(getHeadIndexValue(0, rst, "ActLargeID")))
						$("#actSmallType").val(getHtmlString(getHeadIndexValue(0, rst, "smallName")));
						actSmallTypeId=getHtmlString(getHeadIndexValue(0, rst, "smallId"))
						$("#actBeginTime").val(getHtmlString(getHeadIndexValue(0, rst, "actBeginDate")));
						$("#actEndTime").val(getHtmlString(getHeadIndexValue(0, rst, "actEndDate")));
						$("#rptBeginTime").val(getHtmlString(getHeadIndexValue(0, rst, "rptBeginDate")));
						$("#rptEndTime").val(getHtmlString(getHeadIndexValue(0, rst, "rptEndDate")));
						$("#addr").val(getHtmlString(getHeadIndexValue(0, rst, "address")));
						$("#lng").val(getHtmlString(getHeadIndexValue(0, rst, "Lng")));
						$("#lat").val(getHtmlString(getHeadIndexValue(0, rst, "lat")));
						$("#submitMan").val(getHtmlString(getHeadIndexValue(0, rst, "submitMan")));
						$("#price").val(getHtmlString(getHeadIndexValue(0, rst, "price")));
						$("#actContent").val(getHtmlString(getHeadIndexValue(0, rst, "content")));
						$("#oldPriceDes").val(getHtmlString(getHeadIndexValue(0, rst, "oldPriceDes")));
						$("#priceDes").val(getHtmlString(getHeadIndexValue(0, rst, "priceDes")));
						$("#offDes").val(getHtmlString(getHeadIndexValue(0, rst, "offDes")));
						$("#indexUrl").val(getHtmlString(getHeadIndexValue(0, rst, "indexURL")));
						$("#actType").val(getHtmlString(getHeadIndexValue(0, rst, "type")));
						var status=getHeadIndexValue(0, rst, "status");
						if(status==0){
							$("#save_btn").show();
							$("#cancle_btn").show();
							$("#check_btn").show();
						}else if(status==1){
							$(".isDisabled").attr("disabled",true);
							$("#cancle_btn").show();
							$("#save_btn").hide();
							$("#check_btn").hide();
						}else if(status==2){
							$("#save_btn").show();
							$("#check_btn").show();
						}
						
					
				}else if(rst.state==1){
					art.dialog({fixed:true, lock: true,content:"查询出錯",icon:'error',ok:true});	
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
			
				
		} 
	})
	
	$.ajax({
		type : "get",
		async:false,
		datatype : "json",
		url : "../htmlUtils/find/htmlStr/" + actId + "/activityIndex",
		success : function(data) {
			var rst = JSON.parse(data);
					if(rst.state==0){
						htmlStr=getHeadIndexValue(0, rst, "htmlStr");	
					}
		}	
	});
	$("#doflag").val("2");
	$("#updateId").val(actId)
		$("#content,#yinying1").show();
	*/
		}
		
	function toAdd(){
		window.location.href="addActivitie.html?menu="+getIdByName("menu")+"&submenu="+getIdByName("submenu")

	/* 	resetForm();
		$("#doflag").val(1)
		$("#content,#yinying1").show(); */
	
	}
	
	function saveHtml(){
		if(IsEmpty(editor)){
			htmlStr="";
		}else{	
			htmlStr=editor.html();
		}
		editor.remove("#editIndex")
		var doflag=$("#doflag").val();
		if(doflag==1){		
			if(IsNotEmpty(htmlStr)){
				$("#indexUrl").val("已编辑");
			}else{
				$("#indexUrl").val("未编辑")
			}
			}
		$("#window_changeff,#yinying").hide();
		}
	
	function cancelHtml(){
		
		editor.remove("#editIndex")
		var doflag=$("#doflag").val();
		if(doflag==1){		
			if(IsNotEmpty(htmlStr)){
				$("#indexUrl").val("已编辑");
			}else{
				$("#indexUrl").val("未编辑")
			}
			}
		$("#window_changeff,#yinying").hide();
		}
	function showPrizeLv(){
		$("#yinying1,#windowPop").show();
	}
	function resetForm(){
		$("#shopName2").val("");
		$("#shopId").val("");
		$("#actName").val("");
		$("#imgSrc img").attr("src","../images/img_activities1.jpg");
		$("#imageUrl").val("");
		$("#actLargeType").val("");
		$("#actSmallType").val("");
		$("#actBeginTime").val("");
		$("#actEndTime").val("");
		$("#rptBeginTime").val("");
		$("#rptEndTime").val("");
		$("#lat").val("");
		$("#addr").val("");
		$("#lng").val("");
		$("#submitMan").val("");
		$("#price").val("");
		$("#priceDes").val("");
		$("#actContent").val("")
		$("#oldPriceDes").val("");
		$("#offDes").val("")
		$("#shopId").val("")
		$("#indexUrl").val("");
		$("#doflag").val(1)
		$("#upload").val("")
		$("#cancle_btn").hide();
		$("#check_btn").hide();
		$("#save_btn").show();
		$(".isDisabled").attr("disabled",false)
		browse('upload','imgSrc',96,96);

	}
	
	function popPoint(id){
		art.dialog({fixed:true, lock: true,content:"确认删除该条数据？",icon:'question',ok: function(){ deleteInfo(id)},cancel:true});
		}

	function popPoint2(id){
		art.dialog({fixed:true, lock: true,content:"确认删除该条数据？",icon:'question',ok: function(){ deleteManInfo(id)},cancel:true});
		}

	function showDet(actId){
		window.location.href='lookActivitie.html?actId='+actId
		if($("#shopIsChoosed").is(":checked")){
			var shopID=$("#shopName").val();
			var shopName=$("#shopName").text()
			if(IsEmpty(shopID)){
				shopId="";
			}
			window.location.href="lookActivitie.html?shopCheck=1&actId="+actId+"&shopId="+shopID+"&actName="+$("#searchActName").val()+"&subMan="+$("#searchMan").val()+"&pageIndex="+pageIndex+"&shopName="+shopName;
		}else{
			window.location.href="lookActivitie.html?shopCheck=0&actId="+actId+"&shopId="+$("#shopName").val()+"&actName="+$("#searchActName").val()+"&subMan="+$("#searchMan").val()+"&pageIndex="+pageIndex;
		}			
		/* activityId= actId
		$.ajax({
			type : "get",
			async:false,
			datatype : "json",
			url : "../activityrpt/find/actId/" + actId + "/"+(rptPageIndex-1)+"/5",
			success : function(data) {
				var dt = JSON.parse(data);				
				if(IsEmpty(dt)){
					art.dialog({fixed:true, lock: true,content:"查询出錯",icon:'error',ok:true});	
					return false;
					}
					if(dt.state==0){
						$("#sup2").html("共："+dt.result.len+"条")
						activityrptListTable(dt)
						 var shu = dt.result.len;
						rptPageCount = Math.ceil(shu/10);
						 $("#manPager").pager({ pagenumber: rptPageIndex, pagecount: rptPageCount, buttonClickCallback: PageClick });

					}else if(dt.state==1){
						art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});	
					}else{
						checkStateShowErrorMsgAndDealResult(data);
					}
				
			}	
		});
		
	 $("#activityContent").html($("#actList_actContent_"+actId).html());
		$("#windowPop,#yinying1").show(); */
	}
	
	function activityrptListTable(json){
		$("#activityrptList tbody").empty();
		for ( var i = 0; i < json.result.len; i++) {
			$("#activityrptList tbody").append("<tr></tr>");
			var rptId=getHtmlInt(getHeadIndexValue(i, json, "id"));
			var rptHtm="<td id='rpt_actPsnCount_"+rptId+"'>"+getHtmlString(getHeadIndexValue(i, json, "actPsnCount"))+"</td>"
			 rptHtm+="<td id='rpt_linkMan_"+rptId+"'>"+getHtmlString(getHeadIndexValue(i, json, "linkMan"))+"</td>"
			 rptHtm+="<td id='rpt_linkPhone_"+rptId+"'>"+getHtmlString(getHeadIndexValue(i, json, "linkPhone"))+"</td>"
			 rptHtm+="<td id='rpt_idNumber_"+rptId+"'>"+getHtmlString(getHeadIndexValue(i, json, "idNumber"))+"</td>"
			 rptHtm+="<td id='rpt_email_"+rptId+"'>"+getHtmlString(getHeadIndexValue(i, json, "email"))+"</td>"
			 rptHtm+="<td id='rpt_addr_"+rptId+"'>"+getHtmlString(getHeadIndexValue(i, json, "addr"))+"</td>"
			 rptHtm+="<td id='rpt_shiper_"+rptId+"'>"+getHtmlString(getHeadIndexValue(i, json, "shiper"))+"</td>"
			 rptHtm+="<td id='rpt_staName_"+rptId+"'> <input type='hidden' id=\"rpt_status_"+rptId+"\" value='"+getHtmlString(getHeadIndexValue(i, json, "status"))+"'> "+getHtmlString(getHeadIndexValue(i, json, "staName"))+"</td>"
			 rptHtm+="<td><input type='hidden' id='rpt_payType_"+rptId+"' value='"+getHtmlString(getHeadIndexValue(i, json, "payType"))+"'> <input type=\"button\" class=\"common_btn\" value=\"修改\" onclick=\"showJoin("+rptId+",$(this))\"><input type=\"button\" class=\"del\" value=\"删除\" onclick='popPoint2("+rptId+")'></td>"
			 $("#activityrptList tbody tr:last").append(rptHtm);

		}
	}
	function showJoin(id){
		restManForm();
		$("#actPsnCount").val($("#rpt_actPsnCount_"+id).html());
		$("#LinkMan").val($("#rpt_linkMan_"+id).html());
		$("#linkPhone").val($("#rpt_linkPhone_"+id).html());
		$("#email").val($("#rpt_email_"+id).html());
		$("#idNumber").val($("#rpt_idNumber_"+id).html());
		$("#manAddr").val($("#rpt_addr_"+id).html());
		$("#shiper").val($("#rpt_shiper_"+id).html());
		$("#payType").val($("#rpt_payType_"+id).val());
		$("#doflag2").val(2)
		$("#updateId2").val(id);
		var status= $("#rpt_status_"+id).val();
		if(status==1){
			$("#manCancle_btn").show();
			$("#manSave_btn").hide();
			$("#PopList input[type='text']").attr("disabled",true);
			$("#payType").attr("disabled",true);

		}else if(status==0){
			$("#manSave_btn").val("修改信息");
			$("#manCheck_btn").show();
			$("#manCancle_btn").show();
		}else if(status==2){
			$("#manSave_btn").val("修改信息");
			$("#manCheck_btn").show();
		}
		$("#PopList,#yinyingCenter").show();
	}
	function toAddMan(){
		restManForm();
		$("#manSave_btn").val("添加");
		$("#doflag2").val(1);
		$("#PopList,#yinyingCenter").show();
	}
	function saveMan(){
		var doflag=$("#doflag2").val();
		if(doflag==1){
			addMan()
		}else if(doflag==2){
			editMan()
		}else {
			art.dialog('页面出错', function(){ fresh() });	
		}
	}
	
	function addMan(){
		if(!$.formValidator.pageIsValid()){
			return false;
		}
		var actPsnCount=$("#actPsnCount").val().replace(/\s/gi,'');
		var LinkMan=$("#LinkMan").val().replace(/\s/gi,'');
		var linkPhone = $("#linkPhone").val().replace(/\s/gi,'');
		var email=$("#email").val().replace(/\s/gi,'');
		var idNumber=$("#idNumber").val().replace(/\s/gi,'');
		var addr=$("#manAddr").val().replace(/\s/gi,'');
		var shiper=$("#shiper").val().replace(/\s/gi,'');
		var payType=$("#payType").val();
		
		
		var heads=new Array("actId","actPsnCount","linkMan","linkPhone","email","idNumber","address","shiper","payType")
		var datas=new Array(activityId,actPsnCount,LinkMan,linkPhone,email,idNumber,addr,shiper,payType)
		
		var parser = new Object();
		var jsonParserStr = null;
		if (IsNotEmpty(datas)){
			addToParser(heads, datas, "add" , parser);
			jsonParserStr =  JSON.stringify(parser);
		}
		$.post("../activityrpt/insert",{"data":jsonParserStr}, function(data) {
			var dt = JSON.parse(data);
			
			if(IsEmpty(dt)){
				art.dialog({fixed:true, lock: true,content:"添加出錯",icon:'error',ok:true});	
				return false;
				}
				if(dt.state==0){
					art.dialog({fixed:true, lock: true,content:"添加成功",icon:'succeed',ok:true});	
					showDet(activityId)
					$("#PopList,#yinyingCenter").hide();
				}else if(dt.state==1){
					art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});	
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
			
		});
	}
	function restManForm(){
		$("#manCheck_btn").hide();
		$("#manCancle_btn").hide();
		$("#manSave_btn").show().val("添加参与");
		$("#PopList input[type='text']").val("");
		$("#PopList input[type='text']").attr("disabled",false);
		$("#payType").attr("disabled",false)

	}
	
	function editMan(){
		if(!$.formValidator.pageIsValid()){
			return false;
		}
		var id=$("#updateId2").val();
		var actPsnCount=$("#actPsnCount").val().replace(/\s/gi,'');
		var LinkMan=$("#LinkMan").val().replace(/\s/gi,'');
		var linkPhone = $("#linkPhone").val().replace(/\s/gi,'');
		var email=$("#email").val().replace(/\s/gi,'');
		var idNumber=$("#idNumber").val().replace(/\s/gi,'');
		var addr=$("#manAddr").val().replace(/\s/gi,'');
		var shiper=$("#shiper").val().replace(/\s/gi,'');
		var payType=$("#payType").val();
		
		
		var heads=new Array("actId","actPsnCount","linkMan","linkPhone","email","idNumber","address","shiper","payType","id")
		var datas=new Array(activityId,actPsnCount,LinkMan,linkPhone,email,idNumber,addr,shiper,payType,id)
		
		var parser = new Object();
		var jsonParserStr = null;
		if (IsNotEmpty(datas)){
			addToParser(heads, datas, "edit" , parser);
			jsonParserStr =  JSON.stringify(parser);
		}
		$.post("../activityrpt/edit",{"data":jsonParserStr}, function(data) {
			var dt = JSON.parse(data);
			if(IsEmpty(dt)){
				art.dialog({fixed:true, lock: true,content:"修改出錯",icon:'error',ok:true});	
				return false;
				}
				if(dt.state==0){
					art.dialog({fixed:true, lock: true,content:"修改成功",icon:'succeed',ok:true});	
					showDet(activityId)
					$("#PopList,#yinyingCenter").hide();
				}else if(dt.state==1){
					art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});	
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
			
		});
		
	}
	
	function checkMan(){
		art.dialog({fixed:true, lock: true,icon:'question', content:"确定通过审核？",
			button:[{name:'是',callback:checkedMan },{name:'否'}]});	
	
	}
	checkedMan=function(){
		editStatus(1);
	}
	
	function editStatus(status){
		var id=$("#updateId2").val();
		
		var heads=new Array("status","id")
		var datas=new Array(status,id)
		
		var parser = new Object();
		var jsonParserStr = null;
		if (IsNotEmpty(datas)){
			addToParser(heads, datas, "edit" , parser);
			jsonParserStr =  JSON.stringify(parser);
		}
		$.post("../activityrpt/edit/editStatus",{"data":jsonParserStr}, function(data) {
			var dt = JSON.parse(data);
			if(IsEmpty(dt)){
				art.dialog({fixed:true, lock: true,content:"修改出錯",icon:'error',ok:true});	
				return false;
				}
				if(dt.state==0){
					art.dialog({fixed:true, lock: true,content:"操作成功",icon:'succeed',ok:true});	
					showDet(activityId)
					$("#PopList,#yinyingCenter").hide();
				}else if(dt.state==1){
					art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});	
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
			
		});
	}
	
	function cancleMan(){
		art.dialog({fixed:true, lock: true,icon:'question', content:"确定取消参与？",
			button:[{name:'是',callback:cancledMan },{name:'否'}]});	
	
	}
	cancledMan=function(){
		editStatus(2);
	}
	function deleteManInfo(id){
		if(IsNotEmpty(id)){

			$.post("../activityrpt/del",{"id":id}, function(data) {
				var dt = JSON.parse(data);
				if(IsEmpty(dt)){
					art.dialog({fixed:true, lock: true,content:"删除出錯",icon:'error',ok:true});	
					return false;
					}
					if(dt.state==0){
						art.dialog({fixed:true, lock: true,content:"删除成功",icon:'succeed',ok:true});	
						showDet(activityId)
					}else if(dt.state==1){
						art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});	
					}else{
						checkStateShowErrorMsgAndDealResult(data);
					}	
				
			});
		}
	}
	
	function checkAct(){
		art.dialog({fixed:true, lock: true,icon:'question', content:"确定通过审核？",
			button:[{name:'是',callback:checkedAct },{name:'否'}]});		
	}
	checkedAct=function(){
		editActStatus(1);
	}
	function cancleAct(){
		art.dialog({fixed:true, lock: true,icon:'question', content:"确定取消参与？",
			button:[{name:'是',callback:cancledAct },{name:'否'}]});	
	}
	cancledAct=function(){
		editActStatus(2);
	}
	function editActStatus(status){
		var id=$("#updateId").val();
		
		var heads=new Array("status","id")
		var datas=new Array(status,id)
		
		var parser = new Object();
		var jsonParserStr = null;
		if (IsNotEmpty(datas)){
			addToParser(heads, datas, "edit" , parser);
			jsonParserStr =  JSON.stringify(parser);
		}
		$.post("../activity/edit/editStatus",{"data":jsonParserStr}, function(data) {
			var dt = JSON.parse(data);
			if(IsEmpty(dt)){
				art.dialog({fixed:true, lock: true,content:"修改出錯",icon:'error',ok:true});	
				return false;
				}
				if(dt.state==0){
					art.dialog({fixed:true, lock: true,content:"操作成功",icon:'succeed',ok:true});	
					findActivitesList();
					$("#yinying1,#content").hide();	
				}else if(dt.state==1){
					art.dialog({fixed:true, lock: true,content:dt.msg,icon:'error',ok:true});	
				}else{
					checkStateShowErrorMsgAndDealResult(data);
				}
			
			
		});
	}
	
</script>


</head>

<body>
<!-- InstanceBeginEditable name="EditRegion3" --> 

<div id="yinying1"></div>
<div id="yinyingCenter"></div>
<div id="yinying"></div>
<div id="window_changeff" class="hideDiv"  style=" width:650px;background:#fff;z-index:400;"  >
	<textarea id="editIndex" name="editIndex"></textarea>
	<div class="BottomBtn">
        <input type="button" value="确定" class="common_btn" onclick="saveHtml()" >
        <input type="button" value="取消" style="background-color: red;" class="common_btn" onclick="cancelHtml()" >
      </div>
</div>
    <div class="member_search publish hideDiv" id="content" style="width:780px;">
    <div class="closeTop"><span onclick="closeParent($(this))" class="closeThe"><img src="../images/close.png"></span></div>
    
    	<input type="hidden" id="doflag" value="0">
    	<input type="hidden" id="updateId" >
    	<input type="hidden" id="shopflag">
       <form name="fm1" action="#" target="post">
            <p><span>店面：</span><input type="text"  id="shopName2" readonly class="isDisabled"> <input type="hidden" id="shopId"> <input type="button" value="..." class="btn isDisabled"  onclick="showShopList(2)" /></p>
            <p><span>活动名称：</span><input type="text" id="actName" class="isDisabled"></p>
            
            <p><span>活动图片：</span><input type="text" id="imageUrl" class="isDisabled"><input type="button"  value="..." class="btn"  /><input type="file" class="file isDisabled"  name="upload" id="upload" > <span id="imgSrc" class="onlyImgSrc"> <img  src="../images/img_activities1.jpg"> </span></p>
            <p><label><span>活动大类：</span><input type="text" class="isDisabled" onclick="showHideDiv('window1')"  id="actLargeType"></label>
            <label><span>活动小类：</span><input type="text" class="isDisabled" onclick="showHideDiv('window2')"  id="actSmallType" ></label></p>
            <p><label><span>活动起始日期：</span><input type="text" class="isDisabled doubledate" id="actBeginTime"  readonly="readonly"></label><label><span>活动截止日期：</span><input id="actEndTime" type="text" class="isDisabled doubledate"  readonly="readonly"></label></p>
            <p><label><span>报名起始日期：</span><input type="text" class="isDisabled doubledate" id="rptBeginTime" readonly></label><label><span>报名截止日期：</span><input type="text" id="rptEndTime" class="isDisabled doubledate"  readonly="readonly"></label></p>
            <p><label><span>活动地址：</span>
        <input type="text" id="addr" class="isDisabled">
      </label>
      <label style="min-width:0;"><input class="isDisabled btn"  type="button" value="获取坐标" onclick="findXY()"></label>
      <label style="min-width:0;"><span  style="min-width:0;">X:</span><input class="isDisabled" type="text" style="width:52px;" id="lat" readonly></label>
      <label style="min-width:0;"><span style="min-width:0;">Y:</span><input class="isDisabled" type="text" style="width:52px;" id="lng" readonly></label></p>
            <p><span>提交人：</span><input type="text" class="isDisabled" id="submitMan"><label><span>单价：</span><input class="isDisabled" type="text" id="price"></label></p>
            <p><label><span>活动简介：</span>&nbsp;<textarea class="isDisabled" id="actContent"></textarea></label><label><span>原价描述：</span>&nbsp;<textarea class="isDisabled" id="oldPriceDes"></textarea></label></p>
            <p><label><span>现价描述：</span>&nbsp;<textarea class="isDisabled" id="priceDes"></textarea></label><label><span>优惠描述：</span>&nbsp;<textarea class="isDisabled" id="offDes"></textarea></label></p>
            <p><span>首页：</span><input type="text" id="indexUrl"  readonly>  <input id="editIndex_btn" type="button"  value="编辑首页" class="btn"  /></p>
            <p><label><span>类型：</span><select id="actType" class="isDisabled"><option value="0">报名</option><option value="1">购买</option></select></label></p>
            <div class="BottomBtn">
            <input id="save_btn" type="button" value="保存信息" onclick="toSave()">
            <input id="check_btn" type="button" value="通过审核" onclick="checkAct()" style="display: none;">
            <input id="cancle_btn" type="button" value="取消活动" onclick="cancleAct()" style="display:none;">
            </div>
        </form>
       </div>
<div id="windowPop" class="hideDiv" style="width:1000px;">
  <div class="closeTop"><span class="closeThe" onclick="closeParent($(this))"><img src="../images/close.png"></span></div>
  <div class="boxcontent">
    <div class="box_activities">
      <div class="title"><span>活动说明：</span></div>
      <div class="Detail" id="activityContent">
       
       
      </div>
    </div>
  </div>
  <div class="boxcontent box_blue">
    <div class="box_activities">
      <div class="title"><span>参与名单：</span><i id="partNum2"></i></div>
      <div class="Detail" id="div1">

      	<table width="100%" class="member_list" cellpadding="0" cellspacing="1" border="0" id="activityrptList">
    	<caption><strong>人员列表       <span id="sup2">共0条</span> </strong><input onclick=" toAddMan()" type="button" class="common_btn" value="增加参与人"></caption>
    	<thead>
    	<tr>
    		<th>参与人数</th>
    		<th>联系人</th>
        	<th>联系电话</th>
        	<th>身份证号</th>
        	<th>邮箱</th>
        	<th>地址</th>
        	<th>发货人</th>
        	<th>状态</th>
        	<th>操作</th>
        </tr>
        </thead>
        <tbody>
        	
        </tbody>
    </table>
    <div id="manPager" class="shopPager"></div>
      </div>
    </div>
   
  </div>
</div>
<div id="PopList" class="hideDiv member_search">
  <div class="closeTop"><span class="closeThe" onclick="closeParent($(this))"><img src="../images/close.png"></span></div>
  <input type="hidden" id="doflag2">
  <input type="hidden" id="updateId2">
  <form id="manForm">
  <p><label><span>参与人数：</span><input type="text" id="actPsnCount" ><br><span id="actPsnCountTip"></span> </label> <label><span>联系人：</span><input type="text" id="LinkMan" > <br><span id="LinkManTip"></span> </label></p>
  <p><label><span>联系电话：</span><input type="text" id="linkPhone" ><br><span id="linkPhoneTip"></span></label><label><span>Email：</span><input type="text" id="email" ><br><span id="emailTip"></span></label></p>
  <p><label><span>身份证号：</span><input type="text" id="idNumber" ><br><span id="idNumberTip"></span></label><label><span>地址：</span><input type="text" id="manAddr" > </label></p>
  <p><label><span>发货人：</span><input type="text" id="shiper" ></label><label><span>付款方式：</span><select id="payType"><option value="0">在线支付</option><option value="1">货到付款</option></select></label></p>
	</form>
<div class=BottomBtn abp="40">
<input id="manSave_btn" class="check_btn" value="保存信息" type=button abp="41" onclick="saveMan()">
<input id="manCheck_btn" class="common_btn" value="通过审核" type=button abp="41" onclick="checkMan()" style="display: none;">
<input id="manCancle_btn" class="del" value="取消参与" type=button abp="41" onclick="cancleMan()" style="display: none;">
<input id="manUnCheck_btn" class="del" value="取消报名" type=button abp="41" onclick="enCheckMan()" style="display: none;">
</div>
</div>
<!-- 活动大类 -->
<div class="hideDiv hideOver" id="window1">
 <div class="closeTop"><span class="closeThe" onclick="closeParent($(this))"><img src="../images/close.png"></span></div>
	<table id="actLargeList" width="100%" cellspacing="1" cellpadding="0" border="0" class="member_list">
    	<caption>活动大类       </caption>
    	<thead>
    	<tr>
        	<th>类别</th>
        	<th>操作</th>
        	<th>类别</th>
        	<th>操作</th>
        	<th>类别</th>
        	<th>操作</th>
        	<th>类别</th>
        	<th>操作</th>
        </tr>
        </thead>
        <tbody>
        	
        </tbody>
    </table>
</div>
<!-- 活动小类 -->
<div class="hideDiv hideOver" id="window2">
 <div class="closeTop"><span class="closeThe" onclick="closeParent($(this))"><img src="../images/close.png"></span></div>
	<table id="actSmallList" width="100%" cellspacing="1" cellpadding="0" border="0" class="member_list">
    	<caption>活动小类         </caption>
    	<thead>
    	<tr>
        	<th>类别</th>
        	<th>操作</th>
        	<th>类别</th>
        	<th>操作</th>
        	<th>类别</th>
        	<th>操作</th>
        	<th>类别</th>
        	<th>操作</th>
        </tr>
        </thead>
        <tbody>
        	
        </tbody>
    </table>
</div>
<div class="container" id="container">
  <div class="container_R fr">
      <div class="place">活动管理</div>
  		<div class="member_search">
      <p><span>
        <input type="checkbox" id="shopIsChoosed" style="width:auto;height:auto;border:none;">店面：</span>
        <select id="shopName" onclick="showShopList(1)" disabled="disabled">
        </select>
        <span>活动名称：</span>
        <input type="text" id="searchActName" class="absoluteTxt" >
        <span>提交人：</span>
        <input type="text"  id="searchMan" class="absoluteTxt"></p>
     <p><input class="btn" id="research" name="查询" type="button" value="查询" onClick="findActivitesList()" style="float:right;margin-right:12px;" ></p>
      </div>
       <table width="100%" class="member_list" cellpadding="0" cellspacing="1" border="0" id="activiteList">
    	<caption><strong>活动列表       <span id="sup">共0条</span> </strong> <input type="button" onclick="toAdd()" class="common_btn" value="增加"></caption>
    	<thead>
    	<tr>
    		<th>店面</th>
    		<th>活动名称</th>
        	<th>活动图片</th>
        	<th>活动起始日期</th>
        	<th>活动截止日期</th>
        	<th>活动类型</th>
        	<th>提交人</th>
        	<th>提交日期</th>
        	<th>状态</th>
        	<th>操作</th>
        </tr>
        </thead>
        <tbody>
        	
        </tbody>
       
    </table>
        <div id="NoResult"  class="Nothing" style="text-align:center;display: none;">无符合条件的数据！</div>
  <div id="pager"></div>
  </div>
    <div class="fc"></div>
  
</div>
<!-- InstanceEndEditable --> 
<script type="text/javascript" src="../js/header.js"></script> 
<script type="text/javascript" src="../js/left.js"></script> 
<script type="text/javascript" src="../js/footer.js"></script> 
<script type="text/javascript">
clearThis("absoluteTxt");
showTab(3,4);
</script>

<div id="shopShow" class="hideDiv">
    <div style="float:right;margin-bottom:5px;width:20px;height:20px;line-height:20px;text-align:center;background-color:#eee;margin-bottom:5px;border:1px solid #ccc;" > <span style="cursor: pointer;font-size: 14px;" onclick="closeShopShow();" >X</span> </div>
    <div class="bottom_search"><div class="serWrapper"><input type="text" id="searchName" class="txt"><strong class="refresh" onclick="$('#searchName').val('')">清空</strong></div><input class="common_btn" type="button" style="width:auto;margin-left:5px;" value="查询" onclick="search2()"></div>
    <table   id="shopList" cellpadding="4" cellspacing="0" border="1" width="100%">
    <thead>
    <tr>
    <th>店面ID</th>
    <th>店面名称</th>
    <th>电话</th>
    <th>操作</th>
    </tr>
    </thead>
    </table>
    	<div id="shopPager" class="shopPager"></div>
    </div>
</body>
<!-- InstanceEnd -->
</html>
